package com.cg.task;

import com.cg.service.CrawlerImportService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@RequiredArgsConstructor
@Slf4j
public class CrawlerImportTask {

    private final CrawlerImportService crawlerImportService;

    // 每日零时执行
    @Scheduled(cron = "0 0 0 * * ?")
    public void importDaily() {
        log.info("[Scheduler] 开始执行CSV导入任务");
        crawlerImportService.importCsvFromResources();
        log.info("[Scheduler] CSV导入任务执行完成");
    }
}


